<?php
    function createDB()
    {
        $query = 'CREATE DATABASE '.DB_NAME.';';
        executeQuery( $query );
        $query = 'USE '.DB_NAME.';';
        executeQuery( $query );

    }
    function makeCategory()
    {
        $query = 'CREATE TABLE russian (';
        $query = $query.'song_id INT(5) UNSIGNED AUTO_INCREMENT,';
        $query = $query.'name_groups_or_artists VARCHAR(50) DEFAULT "",';
        $query = $query.'song_name VARCHAR(50) DEFAULT "",';
        $query = $query.'song_text TEXT(5000) DEFAULT "",';
        $query = $query.'link VARCHAR(50) DEFAULT "",';
        $query = $query.'PRIMARY KEY(song_id)';
        $query = $query.');';
        executeQuery( $query );
    }
    function addSong( $name_groups_or_artists, $song_name, $text, $link )
    {
        $name_groups_or_artists = dbEscape( $name_groups_or_artists );
        $song_name = dbEscape( $song_name );
        $text = dbEscape( $text );
        $query = 'INSERT INTO russian SET';
        $query = "$query name_groups_or_artists=\"$name_groups_or_artists\",";
        $query = "$query song_name=\"$song_name\",";
        $query = "$query song_text=\"$text\",";
        $query = "$query link=\"$link\";";
        executeQuery( $query );
    }
    function getSongLists( $name_groups_and_artists )
    {
        $name_groups_and_artists = dbEscape( $name_groups_and_artists );
        $query = "SELECT * FROM russian WHERE name_groups_or_artists=\"$name_groups_and_artists\";";
        return getQueryResults( $query );
    }
    function getLinkSong()
    {
        $name_groups_and_artists = dbEscape( $name_groups_and_artists );
        $query = "SELECT * FROM russian WHERE name_groups_or_artists=\"$name_groups_and_artists\";";
        return getQueryResults( $query );
    }
    function getSong( $id )
    {
        $name_groups_and_artists = dbEscape( $name_groups_and_artists );
        $query = "SELECT * FROM russian WHERE song_id=\"$id\";";
        return getQueryResults( $query );
    }
?>
